package com.yykj.hospital.server.model.entity;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.yykj.common.util.serializer.LocalDate2LongSerializer;
import com.yykj.hospital.server.enums.HospitalNoticeTypeEnum;
import lombok.Data;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.UpdateTimestamp;

import javax.persistence.*;
import java.time.LocalDateTime;

/**
 * 医院公告
 */
@Data
@Entity
public class HospitalNotice {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;

    private Integer hospitalId;

    private String title;

    @Column(columnDefinition = "text")
    private String content;

    private Integer sorting;

    private Boolean status = Boolean.TRUE;

    @Enumerated(value = EnumType.STRING)
    private HospitalNoticeTypeEnum type;

    @CreationTimestamp
    @JsonSerialize(using = LocalDate2LongSerializer.class)
    private LocalDateTime addTime;

    @UpdateTimestamp
    @JsonSerialize(using = LocalDate2LongSerializer.class)
    private LocalDateTime modifyTime;
}
